Forces animated tile group `group` (0-based, in the order that tileset’s groups were authored) of tileset to show `frame` right now, resetting its own timer.
Works differently on Game Boy - An animated tile on the Game Boy takes one of the picture's 192 tiles to itself, and one shown mirrored gets a stored copy, one more tile. Its frames use the 4 shades; a color cycle turns only when its shades are its own.
On other consoles this differs: see Side by side and How the consoles differ.
tile_anim_frame(tileset, group, frame)| Name | Type |
|---|---|
tileset | tileset |
group | int |
frame | int |
Nothing.
Forces one animated tile group of a tileset to show a specific frame right now, resetting that group's own timer. Useful for synchronizing a group to something other than its own free-running timer: a lever that should visibly flip a connected tile the instant it is pulled, rather than waiting for the tile's own cycle to catch up.
group is not a tile index - it is the 0-based position of a group in the order its tileset declared its animated groups (first declared = 0, second = 1, ...). If a tileset animates more than one thing, knowing which index is which means knowing that tileset's own authoring order; see Tile animation's worked example if this still reads as circular. frame is smaller still - it is the 0-based position within that one group's own frame list, wrapped into range; it is never a raw tile-sheet index either.
Worth telling apart from tile_set_index precisely, since the two sound similar but answer different questions. This function repaints a tile slot: every cell in the room that references that one hardware tile index changes together, everywhere, the instant it fires - same index, different pixels. tile_set_index repaints a cell: it changes which index one specific cell references, leaving every other cell untouched - same pixels, different index, at exactly one cell. Reach for this function when "every cell showing this art should animate together" (a torch, a patch of flowing water); reach for tile_set_index when "exactly this one cell should look different" (digging, or any other per-cell terrain change) - an animated group cannot do that second job at all, since it is keyed by tile index, not by position, and singling out one cell would mean authoring a whole separate tile index (and a duplicate copy of the art) for every cell that might ever need it.
A no-op if tileset/group does not name a real, currently-live group - VRAM is only ever touched for a group whose tileset is part of the room actually loaded right now.
Groups are set up in the Paint tab, on the tileset (see Tile animation). A group's number is its place in that tileset's list of animated tiles, counting from 0. The call works the same on a tileset you paint rooms from and on a whole-picture background.
tile_anim_frame(ts_doc_dungeon, 0, 0);Snaps animated tile group 0 of the dungeon tileset back to its own first frame right now.
A no-op if tileset/group does not name a real, currently-live group - VRAM is only ever touched for a group whose tileset is part of the room actually loaded right now.